{
  "info": {
    "_postman_id": "e182e949-bb29-4e70-aa09-4e8f928ca389",
    "name": "BluesPVA Postman Collection - Alpha",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
    "_exporter_id": "41484182"
  },
  "item": [
    {
      "name": "PVA v2 Endpoints",
      "item": [
        {
          "name": "Provider Member Match Kick Off",
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
                  "pm.test('202 Accepted', () => pm.response.to.have.status(202));",
                  "",
                  "// Capture task_id. Primary source: the Content-Location response header",
                  "// (now a RELATIVE path like /v2/Group/provider-member-match-status/<id>).",
                  "// Fallbacks: a task_id in the JSON body, or a Location header.",
                  "function lastSegment(u){",
                  "    if(!u) return '';",
                  "    let s = u.split('?')[0].split('#')[0];",
                  "    if (s.endsWith('/')) s = s.slice(0, -1);   // tolerate trailing slash",
                  "    return s.split('/').pop();",
                  "}",
                  "let mm_task_id = '';",
                  "const loc = pm.response.headers.get('Content-Location') || pm.response.headers.get('Location');",
                  "if (loc) {",
                  "    mm_task_id = lastSegment(loc);",
                  "} else {",
                  "    try { const b = pm.response.json(); if (b && b.task_id) taskId = b.task_id; } catch (e) {}",
                  "}",
                  "",
                  "pm.test('task_id captured', () => {",
                  "    pm.expect(taskId, 'No task_id found. Content-Location header was: ' + loc + '. '",
                  "        + 'If it is missing, the gateway (FITE) did not forward it — the service must emit a RELATIVE Content-Location.')",
                  "        .to.be.a('string').and.not.empty;",
                  "});",
                  "if (mm_task_id) {",
                  "    pm.environment.set('mm_task_id', mm_task_id);",
                  "    console.log('mm_task_id:', mm_task_id, '(from', loc ? 'Content-Location' : 'body', ')');",
                  "} else {",
                  "    console.error('[A2] task_id NOT captured. Content-Location:', loc, '| body:', pm.response.text());",
                  "}"
                ],
                "type": "text/javascript",
                "packages": {},
                "requests": {}
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/fhir+json"
              },
              {
                "key": "Prefer",
                "value": "respond-async"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"resourceType\": \"Parameters\",\n  \"meta\": {\n    \"profile\": [\n      \"http://hl7.org/fhir/us/davinci-pdex/StructureDefinition/provider-parameters-multi-member-match-bundle-in\"\n    ]\n  },\n  \"parameter\": [\n    {\n      \"name\": \"MemberBundle\",\n      \"part\": [\n        {\n          \"name\": \"MemberPatient\",\n          \"resource\": {\n            \"resourceType\": \"Patient\",\n            \"id\": \"ptloc1\",\n            \"name\": [\n              {\n                \"family\": \"Local\",\n                \"given\": [\n                  \"Laura\"\n                ]\n              }\n            ],\n            \"gender\": \"female\",\n            \"birthDate\": \"1985-04-12\"\n          }\n        },\n        {\n          \"name\": \"CoverageToMatch\",\n          \"resource\": {\n            \"resourceType\": \"Coverage\",\n            \"id\": \"covloc1\",\n            \"status\": \"active\",\n            \"identifier\": [\n              {\n                \"type\": {\n                  \"coding\": [\n                    {\n                      \"system\": \"http://terminology.hl7.org/CodeSystem/v2-0203\",\n                      \"code\": \"MB\",\n                      \"display\": \"Member Number\"\n                    }\n                  ]\n                },\n                \"system\": \"http://example.org/payer/member-id\",\n                \"value\": \"LOC00001\"\n              }\n            ],\n            \"subscriberId\": \"LOC00001\",\n            \"relationship\": {\n              \"coding\": [\n                {\n                  \"system\": \"http://terminology.hl7.org/CodeSystem/subscriber-relationship\",\n                  \"code\": \"self\"\n                }\n              ]\n            },\n            \"beneficiary\": {\n              \"reference\": \"Patient/ptloc1\"\n            },\n            \"payor\": [\n              {\n                \"identifier\": {\n                  \"system\": \"http://hl7.org/fhir/sid/us-npi\",\n                  \"value\": \"1003100000\"\n                }\n              }\n            ]\n          }\n        },\n        {\n          \"name\": \"Consent\",\n          \"resource\": {\n            \"resourceType\": \"Consent\",\n            \"id\": \"attloc1\",\n            \"status\": \"active\",\n            \"scope\": {\n              \"coding\": [\n                {\n                  \"system\": \"http://terminology.hl7.org/CodeSystem/consentscope\",\n                  \"code\": \"patient-privacy\"\n                }\n              ]\n            },\n            \"category\": [\n              {\n                \"coding\": [\n                  {\n                    \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ActCode\",\n                    \"code\": \"IDSCL\"\n                  }\n                ]\n              }\n            ],\n            \"patient\": {\n              \"reference\": \"Patient/ptloc1\"\n            },\n            \"dateTime\": \"2024-03-01T00:00:00Z\",\n            \"performer\": [\n              {\n                \"identifier\": {\n                  \"system\": \"http://hl7.org/fhir/sid/us-npi\",\n                  \"value\": \"1004000000\"\n                }\n              }\n            ],\n            \"policy\": [\n              {\n                \"uri\": \"http://example.org/pva/attestation-policy\"\n              }\n            ]\n          }\n        }\n      ]\n    },\n    {\n      \"name\": \"MemberBundle\",\n      \"part\": [\n        {\n          \"name\": \"MemberPatient\",\n          \"resource\": {\n            \"resourceType\": \"Patient\",\n            \"id\": \"ptloc2\",\n            \"name\": [\n              {\n                \"family\": \"Local\",\n                \"given\": [\n                  \"Liam\"\n                ]\n              }\n            ],\n            \"gender\": \"male\",\n            \"birthDate\": \"1978-11-30\"\n          }\n        },\n        {\n          \"name\": \"CoverageToMatch\",\n          \"resource\": {\n            \"resourceType\": \"Coverage\",\n            \"id\": \"covloc2\",\n            \"status\": \"active\",\n            \"identifier\": [\n              {\n                \"type\": {\n                  \"coding\": [\n                    {\n                      \"system\": \"http://terminology.hl7.org/CodeSystem/v2-0203\",\n                      \"code\": \"MB\",\n                      \"display\": \"Member Number\"\n                    }\n                  ]\n                },\n                \"system\": \"http://example.org/payer/member-id\",\n                \"value\": \"LOC00002\"\n              }\n            ],\n            \"subscriberId\": \"LOC00002\",\n            \"relationship\": {\n              \"coding\": [\n                {\n                  \"system\": \"http://terminology.hl7.org/CodeSystem/subscriber-relationship\",\n                  \"code\": \"self\"\n                }\n              ]\n            },\n            \"beneficiary\": {\n              \"reference\": \"Patient/ptloc2\"\n            },\n            \"payor\": [\n              {\n                \"identifier\": {\n                  \"system\": \"http://hl7.org/fhir/sid/us-npi\",\n                  \"value\": \"1003100000\"\n                }\n              }\n            ]\n          }\n        },\n        {\n          \"name\": \"Consent\",\n          \"resource\": {\n            \"resourceType\": \"Consent\",\n            \"id\": \"attloc2\",\n            \"status\": \"active\",\n            \"scope\": {\n              \"coding\": [\n                {\n                  \"system\": \"http://terminology.hl7.org/CodeSystem/consentscope\",\n                  \"code\": \"patient-privacy\"\n                }\n              ]\n            },\n            \"category\": [\n              {\n                \"coding\": [\n                  {\n                    \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ActCode\",\n                    \"code\": \"IDSCL\"\n                  }\n                ]\n              }\n            ],\n            \"patient\": {\n              \"reference\": \"Patient/ptloc2\"\n            },\n            \"dateTime\": \"2024-03-01T00:00:00Z\",\n            \"performer\": [\n              {\n                \"identifier\": {\n                  \"system\": \"http://hl7.org/fhir/sid/us-npi\",\n                  \"value\": \"1004000000\"\n                }\n              }\n            ],\n            \"policy\": [\n              {\n                \"uri\": \"http://example.org/pva/attestation-policy\"\n              }\n            ]\n          }\n        }\n      ]\n    },\n    {\n      \"name\": \"MemberBundle\",\n      \"part\": [\n        {\n          \"name\": \"MemberPatient\",\n          \"resource\": {\n            \"resourceType\": \"Patient\",\n            \"id\": \"ptloc3\",\n            \"name\": [\n              {\n                \"family\": \"Local\",\n                \"given\": [\n                  \"Lucia\"\n                ]\n              }\n            ],\n            \"gender\": \"female\",\n            \"birthDate\": \"1992-02-05\"\n          }\n        },\n        {\n          \"name\": \"CoverageToMatch\",\n          \"resource\": {\n            \"resourceType\": \"Coverage\",\n            \"id\": \"covloc3\",\n            \"status\": \"active\",\n            \"identifier\": [\n              {\n                \"type\": {\n                  \"coding\": [\n                    {\n                      \"system\": \"http://terminology.hl7.org/CodeSystem/v2-0203\",\n                      \"code\": \"MB\",\n                      \"display\": \"Member Number\"\n                    }\n                  ]\n                },\n                \"system\": \"http://example.org/payer/member-id\",\n                \"value\": \"LOC00003\"\n              }\n            ],\n            \"subscriberId\": \"LOC00003\",\n            \"relationship\": {\n              \"coding\": [\n                {\n                  \"system\": \"http://terminology.hl7.org/CodeSystem/subscriber-relationship\",\n                  \"code\": \"self\"\n                }\n              ]\n            },\n            \"beneficiary\": {\n              \"reference\": \"Patient/ptloc3\"\n            },\n            \"payor\": [\n              {\n                \"identifier\": {\n                  \"system\": \"http://hl7.org/fhir/sid/us-npi\",\n                  \"value\": \"1003100000\"\n                }\n              }\n            ]\n          }\n        },\n        {\n          \"name\": \"Consent\",\n          \"resource\": {\n            \"resourceType\": \"Consent\",\n            \"id\": \"attloc3\",\n            \"status\": \"active\",\n            \"scope\": {\n              \"coding\": [\n                {\n                  \"system\": \"http://terminology.hl7.org/CodeSystem/consentscope\",\n                  \"code\": \"patient-privacy\"\n                }\n              ]\n            },\n            \"category\": [\n              {\n                \"coding\": [\n                  {\n                    \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ActCode\",\n                    \"code\": \"IDSCL\"\n                  }\n                ]\n              }\n            ],\n            \"patient\": {\n              \"reference\": \"Patient/ptloc3\"\n            },\n            \"dateTime\": \"2024-03-01T00:00:00Z\",\n            \"performer\": [\n              {\n                \"identifier\": {\n                  \"system\": \"http://hl7.org/fhir/sid/us-npi\",\n                  \"value\": \"1004000000\"\n                }\n              }\n            ],\n            \"policy\": [\n              {\n                \"uri\": \"http://example.org/pva/attestation-policy\"\n              }\n            ]\n          }\n        }\n      ]\n    },\n    {\n      \"name\": \"MemberBundle\",\n      \"part\": [\n        {\n          \"name\": \"MemberPatient\",\n          \"resource\": {\n            \"resourceType\": \"Patient\",\n            \"id\": \"ptnon1\",\n            \"name\": [\n              {\n                \"family\": \"Nonlocal\",\n                \"given\": [\n                  \"Nina\"\n                ]\n              }\n            ],\n            \"gender\": \"female\",\n            \"birthDate\": \"1990-03-15\"\n          }\n        },\n        {\n          \"name\": \"CoverageToMatch\",\n          \"resource\": {\n            \"resourceType\": \"Coverage\",\n            \"id\": \"covnon1\",\n            \"status\": \"active\",\n            \"identifier\": [\n              {\n                \"type\": {\n                  \"coding\": [\n                    {\n                      \"system\": \"http://terminology.hl7.org/CodeSystem/v2-0203\",\n                      \"code\": \"MB\",\n                      \"display\": \"Member Number\"\n                    }\n                  ]\n                },\n                \"system\": \"http://example.org/payer/member-id\",\n                \"value\": \"NON00001\"\n              }\n            ],\n            \"subscriberId\": \"NON00001\",\n            \"relationship\": {\n              \"coding\": [\n                {\n                  \"system\": \"http://terminology.hl7.org/CodeSystem/subscriber-relationship\",\n                  \"code\": \"self\"\n                }\n              ]\n            },\n            \"beneficiary\": {\n              \"reference\": \"Patient/ptnon1\"\n            },\n            \"payor\": [\n              {\n                \"identifier\": {\n                  \"system\": \"http://hl7.org/fhir/sid/us-npi\",\n                  \"value\": \"1003100000\"\n                }\n              }\n            ]\n          }\n        },\n        {\n          \"name\": \"Consent\",\n          \"resource\": {\n            \"resourceType\": \"Consent\",\n            \"id\": \"attnon1\",\n            \"status\": \"active\",\n            \"scope\": {\n              \"coding\": [\n                {\n                  \"system\": \"http://terminology.hl7.org/CodeSystem/consentscope\",\n                  \"code\": \"patient-privacy\"\n                }\n              ]\n            },\n            \"category\": [\n              {\n                \"coding\": [\n                  {\n                    \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ActCode\",\n                    \"code\": \"IDSCL\"\n                  }\n                ]\n              }\n            ],\n            \"patient\": {\n              \"reference\": \"Patient/ptnon1\"\n            },\n            \"dateTime\": \"2024-03-01T00:00:00Z\",\n            \"performer\": [\n              {\n                \"identifier\": {\n                  \"system\": \"http://hl7.org/fhir/sid/us-npi\",\n                  \"value\": \"1004000000\"\n                }\n              }\n            ],\n            \"policy\": [\n              {\n                \"uri\": \"http://example.org/pva/attestation-policy\"\n              }\n            ]\n          }\n        }\n      ]\n    },\n    {\n      \"name\": \"MemberBundle\",\n      \"part\": [\n        {\n          \"name\": \"MemberPatient\",\n          \"resource\": {\n            \"resourceType\": \"Patient\",\n            \"id\": \"ptnon2\",\n            \"name\": [\n              {\n                \"family\": \"Nonlocal\",\n                \"given\": [\n                  \"Oscar\"\n                ]\n              }\n            ],\n            \"gender\": \"male\",\n            \"birthDate\": \"1982-07-22\"\n          }\n        },\n        {\n          \"name\": \"CoverageToMatch\",\n          \"resource\": {\n            \"resourceType\": \"Coverage\",\n            \"id\": \"covnon2\",\n            \"status\": \"active\",\n            \"identifier\": [\n              {\n                \"type\": {\n                  \"coding\": [\n                    {\n                      \"system\": \"http://terminology.hl7.org/CodeSystem/v2-0203\",\n                      \"code\": \"MB\",\n                      \"display\": \"Member Number\"\n                    }\n                  ]\n                },\n                \"system\": \"http://example.org/payer/member-id\",\n                \"value\": \"NON00002\"\n              }\n            ],\n            \"subscriberId\": \"NON00002\",\n            \"relationship\": {\n              \"coding\": [\n                {\n                  \"system\": \"http://terminology.hl7.org/CodeSystem/subscriber-relationship\",\n                  \"code\": \"self\"\n                }\n              ]\n            },\n            \"beneficiary\": {\n              \"reference\": \"Patient/ptnon2\"\n            },\n            \"payor\": [\n              {\n                \"identifier\": {\n                  \"system\": \"http://hl7.org/fhir/sid/us-npi\",\n                  \"value\": \"1003100000\"\n                }\n              }\n            ]\n          }\n        },\n        {\n          \"name\": \"Consent\",\n          \"resource\": {\n            \"resourceType\": \"Consent\",\n            \"id\": \"attnon2\",\n            \"status\": \"active\",\n            \"scope\": {\n              \"coding\": [\n                {\n                  \"system\": \"http://terminology.hl7.org/CodeSystem/consentscope\",\n                  \"code\": \"patient-privacy\"\n                }\n              ]\n            },\n            \"category\": [\n              {\n                \"coding\": [\n                  {\n                    \"system\": \"http://terminology.hl7.org/CodeSystem/v3-ActCode\",\n                    \"code\": \"IDSCL\"\n                  }\n                ]\n              }\n            ],\n            \"patient\": {\n              \"reference\": \"Patient/ptnon2\"\n            },\n            \"dateTime\": \"2024-03-01T00:00:00Z\",\n            \"performer\": [\n              {\n                \"identifier\": {\n                  \"system\": \"http://hl7.org/fhir/sid/us-npi\",\n                  \"value\": \"1004000000\"\n                }\n              }\n            ],\n            \"policy\": [\n              {\n                \"uri\": \"http://example.org/pva/attestation-policy\"\n              }\n            ]\n          }\n        }\n      ]\n    }\n  ]\n}"
            },
            "url": {
              "raw": "{{host_base_url}}/Group/$provider-member-match",
              "host": [
                "{{host_base_url}}"
              ],
              "path": [
                "Group",
                "$provider-member-match"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Provider Member Match Status",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{host_base_url}}/Group/provider-member-match-status/{{mm_task_id}}",
              "host": [
                "{{host_base_url}}"
              ],
              "path": [
                "Group",
                "provider-member-match-status",
                "{{mm_task_id}}"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Provider Member Match Response",
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
                  "pm.test('200 OK', () => pm.response.to.have.status(200));",
                  "",
                  "// Capture group_id from the MatchedMembers Group resource in the response body",
                  "// (Parameters.parameter[name=MatchedMembers].resource.id), not from headers.",
                  "let group_id = '';",
                  "let body;",
                  "try {",
                  "    body = pm.response.json();",
                  "    const matched = (body.parameter || []).find(p => p.name === 'MatchedMembers');",
                  "    if (matched && matched.resource && matched.resource.id) {",
                  "        group_id = matched.resource.id;",
                  "    }",
                  "} catch (e) {}",
                  "",
                  "pm.test('group_id captured', () => {",
                  "    pm.expect(group_id, 'No MatchedMembers.resource.id found in response body: ' + pm.response.text())",
                  "        .to.be.a('string').and.not.empty;",
                  "});",
                  "",
                  "if (group_id) {",
                  "    pm.environment.set('group_id', group_id);",
                  "    console.log('group_id:', group_id, '(from MatchedMembers Group.id in response body)');",
                  "} else {",
                  "    console.error('[group_id] NOT captured. Body:', pm.response.text());",
                  "}"
                ],
                "type": "text/javascript",
                "packages": {},
                "requests": {}
              }
            }
          ],
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{host_base_url}}/Group/provider-member-match-response/{{mm_task_id}}",
              "host": [
                "{{host_base_url}}"
              ],
              "path": [
                "Group",
                "provider-member-match-response",
                "{{mm_task_id}}"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Davinci Data Export Kick Off",
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
                  "pm.test('202 Accepted', () => pm.response.to.have.status(202));",
                  "",
                  "// Capture task_id. Primary source: the Content-Location response header",
                  "// (now a RELATIVE path like /v2/Group/provider-member-match-status/<id>).",
                  "// Fallbacks: a task_id in the JSON body, or a Location header.",
                  "function lastSegment(u){",
                  "    if(!u) return '';",
                  "    let s = u.split('?')[0].split('#')[0];",
                  "    if (s.endsWith('/')) s = s.slice(0, -1);   // tolerate trailing slash",
                  "    return s.split('/').pop();",
                  "}",
                  "let export_task_id = '';",
                  "const loc = pm.response.headers.get('Content-Location') || pm.response.headers.get('Location');",
                  "if (loc) {",
                  "    export_task_id = lastSegment(loc);",
                  "} else {",
                  "    try { const b = pm.response.json(); if (b && b.task_id) taskId = b.task_id; } catch (e) {}",
                  "}",
                  "",
                  "pm.test('export_task_id captured', () => {",
                  "    pm.expect(export_task_id, 'No task_id found. Content-Location header was: ' + loc + '. '",
                  "        + 'If it is missing, the gateway (FITE) did not forward it — the service must emit a RELATIVE Content-Location.')",
                  "        .to.be.a('string').and.not.empty;",
                  "});",
                  "if (export_task_id) {",
                  "    pm.environment.set('export_task_id', export_task_id);",
                  "    console.log('export_task_id:', export_task_id, '(from', loc ? 'Content-Location' : 'body', ')');",
                  "} else {",
                  "    console.error('[A2] export_task_id NOT captured. Content-Location:', loc, '| body:', pm.response.text());",
                  "}"
                ],
                "type": "text/javascript",
                "packages": {},
                "requests": {}
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Prefer",
                "value": "respond-async",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{host_base_url}}/Group/{{group_id}}/$davinci-data-export-v2?exportType=hl7.fhir.us.davinci-pdex%23provider-snapshot",
              "host": [
                "{{host_base_url}}"
              ],
              "path": [
                "Group",
                "{{group_id}}",
                "$davinci-data-export-v2"
              ],
              "query": [
                {
                  "key": "exportType",
                  "value": "hl7.fhir.us.davinci-pdex%23provider-snapshot"
                }
              ]
            }
          },
          "response": []
        },
        {
          "name": "Davinci Data Export Status + Report",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{host_base_url}}/Group/davinci-data-export-status-v2/{{export_task_id}}",
              "host": [
                "{{host_base_url}}"
              ],
              "path": [
                "Group",
                "davinci-data-export-status-v2",
                "{{export_task_id}}"
              ]
            }
          },
          "response": []
        },
        {
          "name": "Davinci Data Export Download First Resource",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{host_base_url}}/Group/davinci-data-export-download-v2/{{download_token}}",
              "host": [
                "{{host_base_url}}"
              ],
              "path": [
                "Group",
                "davinci-data-export-download-v2",
                "{{download_token}}"
              ]
            }
          },
          "response": []
        }
      ]
    },
    {
      "name": "Blues Home API Endpoints",
      "item": [
        {
          "name": "Nonlocal Nina — Match",
          "item": [
            {
              "name": "$member-match — 200 match",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "pm.test('200 OK', () => pm.response.to.have.status(200));",
                      "const body = pm.response.json();",
                      "pm.test('FHIR Parameters', () => pm.expect(body.resourceType).to.eql('Parameters'));",
                      "",
                      "const memberId = body.parameter && body.parameter.find(p => p.name === 'MemberId');",
                      "pm.test('MemberId parameter present', () => pm.expect(memberId, 'no MemberId param in response').to.not.be.undefined);",
                      "",
                      "const ref = memberId && memberId.valueReference && memberId.valueReference.reference;",
                      "pm.test('MemberId.valueReference contains Patient/{id}', () => pm.expect(ref).to.match(/\\/?Patient\\/[^/]+$/));",
                      "",
                      "// Supports both relative (Patient/{id}) and absolute (https://.../Patient/{id}) refs.",
                      "if (ref) {",
                      "    const patientId = ref.replace(/.*\\/?Patient\\//, '');",
                      "    pm.environment.set('nina_patient_id', patientId);",
                      "    console.log('nina_patient_id =', patientId);",
                      "}"
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/fhir+json"
                  }
                ],
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"resourceType\": \"Parameters\",\n  \"parameter\": [\n    {\n      \"name\": \"MemberPatient\",\n      \"resource\": {\n        \"resourceType\": \"Patient\",\n        \"name\": [ { \"family\": \"Nonlocal\", \"given\": [ \"Nina\" ] } ],\n        \"gender\": \"female\",\n        \"birthDate\": \"1990-03-15\"\n      }\n    },\n    {\n      \"name\": \"CoverageToMatch\",\n      \"resource\": {\n        \"resourceType\": \"Coverage\",\n        \"status\": \"active\",\n        \"identifier\": [\n          {\n            \"type\": {\n              \"coding\": [\n                {\n                  \"system\": \"http://terminology.hl7.org/CodeSystem/v2-0203\",\n                  \"code\": \"MB\",\n                  \"display\": \"Member Number\"\n                }\n              ]\n            },\n            \"system\": \"http://example.org/payer/member-id\",\n            \"value\": \"NON00001\"\n          }\n        ],\n        \"subscriberId\": \"NON00001\",\n        \"relationship\": { \"coding\": [ { \"system\": \"http://terminology.hl7.org/CodeSystem/subscriber-relationship\", \"code\": \"self\" } ] },\n        \"beneficiary\": { \"reference\": \"Patient/flowc-nonlocal-9001\", \"display\": \"Nina Nonlocal\" },\n        \"payor\": [ { \"identifier\": { \"system\": \"http://hl7.org/fhir/sid/us-npi\", \"value\": \"1003100000\" } } ]\n      }\n    }\n  ]\n}\n",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "url": {
                  "raw": "{{home_base_url}}/Patient/$member-match",
                  "host": [
                    "{{home_base_url}}"
                  ],
                  "path": [
                    "Patient",
                    "$member-match"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "$everything — 200 Bundle",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "pm.test('200 OK', () => pm.response.to.have.status(200));",
                      "const body = pm.response.json();",
                      "pm.test('FHIR Bundle', () => pm.expect(body.resourceType).to.eql('Bundle'));",
                      "pm.test('searchset type', () => pm.expect(body.type).to.eql('searchset'));",
                      "const hasPatient = (body.entry || []).some(e => e.resource && e.resource.resourceType === 'Patient');",
                      "pm.test('Bundle includes the Patient resource', () => pm.expect(hasPatient).to.be.true);"
                    ]
                  }
                }
              ],
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/fhir+json"
                  }
                ],
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"resourceType\": \"Parameters\",\n  \"parameter\": []\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "url": {
                  "raw": "{{home_base_url}}/Patient/{{nina_patient_id}}/$everything",
                  "host": [
                    "{{home_base_url}}"
                  ],
                  "path": [
                    "Patient",
                    "{{nina_patient_id}}",
                    "$everything"
                  ]
                }
              },
              "response": []
            }
          ],
          "description": "Non-local member who MATCHES on the Home plan. $member-match returns 200 + a MemberId whose Patient/{id} feeds the chained $everything. Drives the Host MatchedMembers bucket."
        },
        {
          "name": "Nonlocal Oscar — Opt-Out",
          "item": [
            {
              "name": "$member-match — 422 opt-out",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "pm.test('422 Unprocessable Entity', () => pm.response.to.have.status(422));",
                      "const body = pm.response.json();",
                      "pm.test('OperationOutcome', () => pm.expect(body.resourceType).to.eql('OperationOutcome'));",
                      "const codes = (body.issue || []).map(i => i.code);",
                      "pm.test('issue.code signals opt-out (forbidden/suppressed/insufficient-consent)', () =>",
                      "    pm.expect(codes.some(c => ['forbidden', 'suppressed', 'security'].includes(c)) || JSON.stringify(body).toLowerCase().includes('consent'),",
                      "        'expected a consent/forbidden signal; got codes: ' + codes.join(',')).to.be.true);"
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/fhir+json"
                  }
                ],
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"resourceType\": \"Parameters\",\n  \"parameter\": [\n    {\n      \"name\": \"MemberPatient\",\n      \"resource\": {\n        \"resourceType\": \"Patient\",\n        \"name\": [ { \"family\": \"Nonlocal\", \"given\": [ \"Oscar\" ] } ],\n        \"gender\": \"male\",\n        \"birthDate\": \"1982-07-22\"\n      }\n    },\n    {\n      \"name\": \"CoverageToMatch\",\n      \"resource\": {\n        \"resourceType\": \"Coverage\",\n        \"status\": \"active\",\n        \"identifier\": [\n          {\n            \"type\": {\n              \"coding\": [\n                {\n                  \"system\": \"http://terminology.hl7.org/CodeSystem/v2-0203\",\n                  \"code\": \"MB\",\n                  \"display\": \"Member Number\"\n                }\n              ]\n            },\n            \"system\": \"http://example.org/payer/member-id\",\n            \"value\": \"NON00002\"\n          }\n        ],\n        \"subscriberId\": \"NON00002\",\n        \"relationship\": { \"coding\": [ { \"system\": \"http://terminology.hl7.org/CodeSystem/subscriber-relationship\", \"code\": \"self\" } ] },\n        \"beneficiary\": { \"reference\": \"Patient/flowc-nonlocal-9002\", \"display\": \"Oscar Nonlocal\" },\n        \"payor\": [ { \"identifier\": { \"system\": \"http://hl7.org/fhir/sid/us-npi\", \"value\": \"1003100000\" } } ]\n      }\n    }\n  ]\n}\n",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "url": {
                  "raw": "{{home_base_url}}/Patient/$member-match",
                  "host": [
                    "{{home_base_url}}"
                  ],
                  "path": [
                    "Patient",
                    "$member-match"
                  ]
                }
              },
              "response": []
            },
            {
              "name": "$everything — refused (opt-out)",
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "exec": [
                      "pm.test('export refused for opted-out member (422 or 404)', () =>",
                      "    pm.expect([422, 404]).to.include(pm.response.code));",
                      "const body = pm.response.json();",
                      "pm.test('OperationOutcome', () => pm.expect(body.resourceType).to.eql('OperationOutcome'));"
                    ],
                    "type": "text/javascript",
                    "packages": {},
                    "requests": {}
                  }
                }
              ],
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/fhir+json"
                  }
                ],
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"resourceType\": \"Parameters\",\n  \"parameter\": []\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                },
                "url": {
                  "raw": "{{home_base_url}}/Patient/{{oscar_patient_id}}/$everything",
                  "host": [
                    "{{home_base_url}}"
                  ],
                  "path": [
                    "Patient",
                    "{{oscar_patient_id}}",
                    "$everything"
                  ]
                }
              },
              "response": []
            }
          ],
          "description": "Non-local member who has an active consent opt-out on the Home plan. $member-match returns 422 insufficient-consent (the Home plan is truthful). The Host is what MASKS this into NonMatchedMembers so the opt-out is not disclosed.\n\n$everything targets Oscar's known ingested Patient id (flowc-nonlocal-9002) directly to show export is ALSO refused for an opted-out member — no id is captured from the 422 above."
        }
      ],
      "description": "Home-plan HRex $member-match + PDex $everything, exercised per member.\n\nThese requests hit the Home plan DIRECTLY (not through the Host). Note the Home-plan HTTP response is not the same thing as the Host bucket:\n\n| Member | subscriberId | Home $member-match | Host bucket it drives |\n|--------|--------------|--------------------|-----------------------|\n| Nina Nonlocal | NON00001 | 200 + MemberId (match) | MatchedMembers |\n| Oscar Nonlocal | NON00002 | 422 insufficient-consent (opt-out) | NonMatchedMembers (Host MASKS the 422 as no-match) |\n\nOscar's 422 opt-out is truthful at the Home plan; the Host is what deliberately reclassifies a non-local opt-out into NonMatched so the opt-out isn't disclosed to the provider.",
      "auth": {
        "type": "oauth2",
        "oauth2": [
          {
            "key": "scope",
            "value": "system/Patient.read",
            "type": "string"
          },
          {
            "key": "clientSecret",
            "value": "{{HOME_CLIENT_SECRET}}",
            "type": "string"
          },
          {
            "key": "clientId",
            "value": "{{HOME_CLIENT_ID}}",
            "type": "string"
          },
          {
            "key": "accessTokenUrl",
            "value": "{{home_token_url}}",
            "type": "string"
          },
          {
            "key": "grant_type",
            "value": "client_credentials",
            "type": "string"
          },
          {
            "key": "tokenName",
            "value": "Home Token",
            "type": "string"
          },
          {
            "key": "addTokenTo",
            "value": "header",
            "type": "string"
          }
        ]
      },
      "event": [
        {
          "listen": "prerequest",
          "script": {
            "type": "text/javascript",
            "packages": {},
            "requests": {},
            "exec": [
              ""
            ]
          }
        },
        {
          "listen": "test",
          "script": {
            "type": "text/javascript",
            "packages": {},
            "requests": {},
            "exec": [
              ""
            ]
          }
        }
      ]
    }
  ],
  "auth": {
    "type": "oauth2",
    "oauth2": [
      {
        "key": "clientSecret",
        "value": "{{HOST_CLIENT_SECRET}}",
        "type": "string"
      },
      {
        "key": "clientId",
        "value": "{{HOST_CLIENT_ID}}",
        "type": "string"
      },
      {
        "key": "scope",
        "value": "system/Group.read",
        "type": "string"
      },
      {
        "key": "tokenName",
        "value": "Token",
        "type": "string"
      },
      {
        "key": "accessTokenUrl",
        "value": "{{token_url}}",
        "type": "string"
      },
      {
        "key": "grant_type",
        "value": "client_credentials",
        "type": "string"
      },
      {
        "key": "addTokenTo",
        "value": "header",
        "type": "string"
      }
    ]
  },
  "event": [
    {
      "listen": "prerequest",
      "script": {
        "type": "text/javascript",
        "packages": {},
        "requests": {},
        "exec": [
          ""
        ]
      }
    },
    {
      "listen": "test",
      "script": {
        "type": "text/javascript",
        "packages": {},
        "requests": {},
        "exec": [
          ""
        ]
      }
    }
  ]
}